#ifndef RV32I_SC_INSTDECODER_H
#define RV32I_SC_INSTDECODER_H

#include <queue>
#include "systemc.h"
#include "tlm.h"
#include "tlm_utils/simple_target_socket.h"
#include "tlm_utils/simple_initiator_socket.h"

#include "InstB.h"
#include "InstI.h"
#include "InstJ.h"
#include "InstR.h"
#include "InstS.h"
#include "InstU.h"

class InstDecoder : public sc_module {
public:
    SC_HAS_PROCESS(InstDecoder);

    InstDecoder(sc_module_name name);
    ~InstDecoder();

    tlm_utils::simple_target_socket<InstDecoder>  target_socket;
    tlm_utils::simple_initiator_socket<InstDecoder>  initiator_socket;

    void
    sendInst();

private:
    void
    recieveInst(tlm::tlm_generic_payload  &payload, sc_core::sc_time &delay_time);

    tlm::tlm_response_status gp_status;

    RegBank<REG_NUM>  *r;
    RegBank<CSR_NUM> *csr;
    Mem *m;

    std::queue<Inst *> inst_fifo;

    uint32_t pc;
};


#endif //RV32I_SC_INSTDECODER_H
